package com.ssyc.gsk_teacher_appraisal.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ssyc.gsk_teacher_appraisal.R;
import com.ssyc.gsk_teacher_appraisal.bean.TabInfo;

import java.util.List;

/**
 * 顶部Tab栏的适配器
 * Created by Administrator on 2018/10/8 0008.
 */

public class TabRvAdapter extends BaseQuickAdapter<TabInfo, BaseViewHolder> {
    private Context context;

    public TabRvAdapter(Context context, int layoutResId, @Nullable List<TabInfo> data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, TabInfo item) {
        //标题
        TextView tvTitle = helper.getView(R.id.tv_title);

        //数字
//        TextView tvNum = helper.getView(R.id.tv_num);

        //导航线条
        View line = helper.getView(R.id.line);

        tvTitle.setText(item.title);

//        tvNum.setText(item.num);

        if (item.isSelected) {
            line.setVisibility(View.VISIBLE);
            tvTitle.setTextColor(context.getResources().getColor(R.color.tab_select_color));
//            tvNum.setTextColor(context.getResources().getColor(R.color.tab_select_color));
        } else {
            line.setVisibility(View.INVISIBLE);
            tvTitle.setTextColor(context.getResources().getColor(R.color.white));
//            tvNum.setTextColor(context.getResources().getColor(R.color.white));
        }
    }
}
